<?php
/* @var $this Ajde_Template_Parser_Phtml_Helper */

/* @var $transaction Ajde_Shop_Transaction */
$transaction = $this->transaction;
?>

<h2>Payment</h2>

<?php if ($transaction->hasLoaded() === false) { ?>
	
	<h4>Transaction not found</h4>
	<p><a href='shop'>Back to shop</a></p>

<?php } else { ?>

	<?php echo $this->ACAjaxForm('shop/transaction:payment', null, 'transactionPayment'); ?>

		<h4>Choose method</h4>
		<dl class='form wide'>
			<dt>Total payable amount</dt>
			<dd><?php echo $transaction->getFormattedTotal(); ?></dd>
			
			<dt>&nbsp;</dt>
			<dd><hr/></dd>
			
			<dt>&nbsp;</dt>
			<dd class="status"><?php echo __('Please choose your method of payment') ?></dd>
			
			<dt>Payment provider:</dt>
			<dd class='provider'>
				<?php foreach($transaction->getProviders() as $key => $provider) {
					/* @var $provider Ajde_Shop_Transaction_Provider */ ?>
				<input type='radio' name='provider' value='<?php echo _e($key); ?>' id='<?php echo _e($key); ?>' /><label for='<?php echo _e($key); ?>'>
					<?php if ($provider->getLogo()) { ?>
						<img src='<?php echo _e($provider->getLogo()); ?>' alt='<?php echo _e($provider->getName()); ?>' width='75' style='vertical-align: middle;' />
					<?php } else { ?>
						<?php echo _e($provider->getName()); ?>
					<?php } ?>
				</label>
				<?php } ?>
			</dd>		
		</dl>

		<div class='toolbar'>
			<input type='submit' class='action' value='Pay &amp; complete order' />
			<a href='shop/transaction:setup'>Edit shipping details</a>
		</div>

	</form>
	
	<div id="postproxy"></div>
	
<?php } ?>